<%if @project.finished_milestones.size>0%>
<!--Completed start-->
<div id=finished_milestone>
<div class="milestone_label finished"><%="Completed Milestone".t%> </div>
<%@project.finished_milestones.each do |milestone|%>
<div class="milestone_item finished_item">
 <span id='show_perg_<%=milestone.id%>' class='show_perg'>
 <table><tr><td><%=milestone.percentage.to_i.to_s%>%</td><td align=right>
 <table><tr><td width="<%=milestone.percentage.to_i%>%" class=past>&nbsp;</td>
     <%if 100-milestone.percentage.to_i > 0%>
       <td width="<%=100-milestone.percentage.to_i%>%">&nbsp;</td>
     <%end%>
 </tr></table>
 </td></tr></table>
 </span>
<%="<strong>" + time_ago_in_words(milestone.due_at) + " later".t + "</strong>(" + milestone.due_at.strftime('%m/%d %Y') + ")"%>
<span class='intro_txt'> <%=" - " + milestone.user.name if milestone.user%></span>
 <span class="private_label float_right"><%="Private".t if milestone.private%></span>
<h2><span id='indi_<%=milestone.id%>' style="display:none"><%=image_tag"indicator.gif"%></span> 
 <%=check_box_tag "ss","",true,{:onclick=>remote_function(:url=>{:controller=>'milestones',:action=>'unfinish',:id=>milestone.id,:project_id=>milestone.project.id},:loading=>"Element.show('indi_#{milestone.id}')"),:disabled=>(not (@cur_user == milestone.user or (@project.use_permission and (@cur_user.have_power?(@project) or @cur_user.has_permission?("prj_" + @project.id.to_s + "_ms_edit"))) or (not @project.use_permission or @project.use_permission.nil?)))}%>
<%=milestone.name%>
<%if @cur_user == milestone.user or (@project.use_permission and (@cur_user.have_power?(@project) or @cur_user.has_permission?("prj_" + @project.id.to_s + "_ms_edit"))) or (not @project.use_permission or @project.use_permission.nil?)%>
  <%=link_to"Edit".t,edit_project_milestone_path(milestone.project,milestone),:class=>'admin'%> 
  <%=link_to image_tag("trash.gif",:border=>0),project_milestone_path(@project,milestone),:method=>'delete',:confirm=>"Are you sure?".t,:class=>'admin'%>
  <%=link_to image_tag("arrow_bellow.gif",:border=>0,:alt=>"Change percentage",:style=>"display:on"), "#", :onclick=>"Element.show('change_perg_#{milestone.id}')"%> 
  <div class='percentage'  style="display:none" id='change_perg_<%=milestone.id%>'>
   <table border=0>
      <tr>
        <td> <%=link_to image_tag("close.gif",:border=>0,:id=>"close_perg_" + milestone.id.to_s,:style=>"display:on"),"#",:onclick=>"Element.hide('change_perg_#{milestone.id}')"%> </td>
        <%0.upto(10) do |i|%>
          <td class="<%=(i*10<=milestone.percentage.to_i ? "past" : "due")%>" onmouseover="this.className='onmouse'" onmouseout="this.className='<%=(i*10<=milestone.percentage.to_i ? "past" : "due")%>'" onclick="new Ajax.Request('/milestones/change_percentage/<%=milestone.id%>?project_id=<%=milestone.project.id%>&percentage=<%=i*10%>', {asynchronous:true, evalScripts:true, onLoading:function(request){Element.show('indi_<%=milestone.id%>')}});"><%=i*10%>%</td>
	<%end%>
   </table>
  </div>
  <%end%>

<%if (todos=milestone.todos).size > 0%>
 <%todos.each do |t|%>
   <li><%=link_to t.name,project_todos_path(@project)%> <span class=intro_txt>(<%="to-do list".t%>)</span></li>
 <%end%>
<%end%>
</h2>
</div>
<%end%>
</div>
<!--Completed end-->
<%end%>
